package com.learning.dubbo.features.log.consumer;

import com.learning.dubbo.features.log.api.GreetingsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * ClassName: Consumer
 * Description: 消费客户端
 * Date: 2020/6/15 13:43 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Slf4j
public class Consumer {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml");
        context.start();

        // 获取远程服务代理
        GreetingsService greetingsService = (GreetingsService) context.getBean("greetingsService");
        // 执行远程方法，同步方法
        String result = greetingsService.sayHi("Dubbo");
        // 显示调用结果
        log.info("~~~~~~~~~~~ {} ~~~~~~~~~~~~~", result);

        // 代理对象
        log.info(greetingsService.getClass().getName());
        context.close();
    }


}
